<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%--引用标签--%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<%@ include file="/WEB-INF/include/head.basic.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>数据查询</title>
<script type="text/javascript">
	$(function(){
		if('${errorMsg}'!=null && '${errorMsg}'!=''){
			  //错误提示信息
			 $('#tipInfos').addClass('error');
			 $('#tipInfos').html('${errorMsg}');
		}else if('${successMsg}'!=null && '${successMsg}'!=''){
			  //成功提示信息
			 $('#tipInfos').addClass('success');
			 $('#tipInfos').html('${successMsg}');
		}
	});
	function delFun(id){
		$.messager.confirm("确认删除", "确认删除吗？", function (r) {  
	         if (r) {
	        	 $.ajax({
	     			url :'removeRecord',
	     			type:'GET',
	     			dataType:'json',
	     			data:{"id":id},
	     			success:function(data){
	     				if(data.code=='0'){
	     					$('#search').submit();
	     				}else{
	     					$.messager.alert('提示', '删除失败!', 'warning');
	     				} 
	     			}
	     		});
	         }
		 }); 
	}
</script>
</head>
<body>
	<form:form action="search"  id="search" modelAttribute="user">
    <fieldset class="fieldset-self">
        <legend>查询条件</legend>
        <table align="center">
            <tr align="center">
                <td style="padding-right: 80px;" align="right">用户名称：<form:input path="account" cssClass="easyui-textbox"/></td>
                <td><a href="###" class="easyui-linkbutton" iconCls="icon-search" onclick="$('#search').submit();">查询</a></td>
           </tr>
        </table>
    </fieldset>
</form:form>
<div id="tipInfos"></div>
<table id="stupidtable" width="100%" align="center" class="table">
	<thead>
		<tr>
			<th>序号</th>
			<th>用户名</th>
			<th>真实姓名</th>
			<th>性别</th>
			<th>邮箱</th>
			<th>手机号码</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${recordList}" var="bean" varStatus="status">
			<tr onmouseover="this.bgColor='#EAF2FF'" onmouseout="this.bgColor='#FFFFFF'" align="center">
            <th style="background-size: 100%;">${(pageInfo.pageNo - 1) * pageInfo.pageSize + status.index + 1}</th>
            <td align="left">${bean.account}</td>
            <td align="left">${bean.realName}</td>
            <td align="left">${bean.sex==0?'男':'女'}</td>
            <td align="left">${bean.email}</td>
            <td align="left">${bean.mobile}</td>
            <td align="left">
            	<c:url var="url" value="/user/editUser">
                	<c:param name="id" value="${bean.id}"/>
            	</c:url>
            	<c:url var="url1" value="/user/bindRole">
                	<c:param name="id" value="${bean.id}"/>
            	</c:url>
                <a href="${url}" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
                <a href="###" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick="delFun('${bean.id}')">删除</a>
                <a href="${url1}" class="easyui-linkbutton" data-options="iconCls:'icon-add'">绑定角色</a>
            </td>
		</c:forEach>
	</tbody>
	<tfoot>
    <tr>
        <td colspan="7">
            <c:if test="${fn:length(recordList) > 0}">
                <div align="right">
                    <p:createPager curPage="${pageInfo.pageNo}" totalCount="${pageInfo.count}"
                                   pageSize="${pageInfo.pageSize}" totalPage="${pageInfo.total}" formId="search"/>
                </div>
            </c:if>
        </td>
    </tr>
    </tfoot>
</table>
</body>
</html>